package com.one.service.impl;

import com.one.mapper.LandRecordMapper;
import com.one.pojo.LandRecord;
import com.one.service.LandRecordService;
import com.one.util.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description
 * @Author semstouch
 * @Date 2017/4/11
 **/
@Service
public class LandRecordServiceImpl implements LandRecordService{
    @Resource
    private LandRecordMapper landRecordMapper;

    @Override
    public int add(LandRecord landRecord) {
        landRecord.setId(StringUtils.getUUID());
        return landRecordMapper.insertSelective(landRecord);
    }

    @Override
    public int countNum(String userId, String type) {
        return landRecordMapper.countNum(userId,type);
    }

    @Override
    public List<LandRecord> findByUserId(String userId, String type, int numPerPage, int currentPage) {
        int start = 0;
        start = (currentPage - 1) * numPerPage;
        return landRecordMapper.findByUserId(userId,type,start,numPerPage);
    }
}
